# install.packages("mapview")
# install.packages("sf")
# install.packages("webshot2")
library(tidyverse)
library(readxl)
library(mapview)
library(sf)[Assess] Coastal Livelihoods Case Study
📍 Isle de Jean Charles
Class Overview
- Centering activity
- Setting the stage
- Paired coding
Centering Activity
- Dr. Caballero
- Ross Gay’s reading from Catalog of Unabashed Gratitude, To the Fig Tree on 9th and Christian
Setting the Stage
- This week’s focus is on plotting data!
- Using archived data from federal organizations such as:
- Federal Emergency Management Agency (FEMA)
- Department of Transportation (DOT)
- Centers for Disease Control (CDC)
- National Oceanic and Atmospheric Administration (NOAA)
Learning Outcomes
- Explore aesthetic mappings
- Use different geom functions to visualize variables
- Apply statistical transformations and position adjustments
- Connect findings to theoretical understandings of recognition justice
Let’s get Started
- Find your pair
- Open Posit
Load packages
- Remember that we only need to install packages once
- paste the commented code into your console to install packages you don’t yet have.
- include lines 4-7 in your analysis.qmd document
The Grammar of Graphics
- Any graphic can be built using the same components:
- data set (what we visualize)
- coordinate system (where the data should go)
- geom (how the data should be visualized)
Today’s Recipe

Where we’re headed

Load data
LA_tracts <- read_sf("data/LA_tracts/LA_tracts.shp")# | eval: true
# | echo: false
LA_tracts <- read_sf("~/Library/CloudStorage/GoogleDrive-mc152@wellesley.edu/My Drive/Teaching/ES-202/Case Study Code/data/week_05/LA_tracts/LA_tracts.shp")Understanding our data
- Let’s take a look at how this data looks.
glimpse(LA_tracts)Rows: 1,376
Columns: 10
$ state <chr> "Louisiana", "Louisiana", "Louisiana", "Louisiana", "Louisian…
$ county <chr> "Lafayette", "Lafayette", "Vermilion", "St. Martin", "St. Mar…
$ gegrphy <chr> "LA", "LA", "LA", "LA", "LA", "LA", "LA", "LA", "LA", "LA", "…
$ pct_sth <dbl> 4.1503823, 8.1000000, 1.6978710, 4.1154232, 5.7540218, 4.2769…
$ pct_cnc <dbl> 3.7503771, 7.1000000, 1.0837475, 2.3294546, 4.0278153, 2.5407…
$ pc_200_ <dbl> 30.14978, 19.73158, 31.13836, 18.35729, 35.25180, 46.30960, 3…
$ trnsp_b <dbl> 0.1909443, 0.1220533, 0.2269403, 0.1586263, 0.1301868, 0.2927…
$ cf_nn__ <chr> "0", "0", "0", "0", "2-4", "0", "0", "0", "0", "0", "0", "0",…
$ trnsp__ <chr> "15-20%", "10-15%", "20-25%", "15-20%", "10-15%", "25+%", "20…
$ geometry <MULTIPOLYGON [°]> MULTIPOLYGON (((-92.0536 30..., MULTIPOLYGON (((…
Looking at spatial data
- the
geometryvariable data in our dataframe and the.shpfile type of data suggests this is spatial data. - let’s quickly map things, to see what data we have. I’ll visualize the
gegrphycolumn using themapview()function.
LA_tracts |>
mapview(zcol = "gegrphy")